package com.wsfk.ssm.service.client;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.List;

import com.wsfk.ssm.entity.Bill;
import com.wsfk.ssm.entity.Product;
import com.wsfk.ssm.entity.User;

public interface InAppPurchaseSvc {

	public abstract List<Product> queryProduces(String appId);

	public abstract String addBill(String in, String userid, Date now);

	public abstract Bill addOder(String json, Date now, String billid);

	/**
	 * 此方法返回false时，
	 * 可能回将订单的原有数据替换
	 * 此bug未修复
	 * @param in
	 * @param userid
	 * @return
	 */
	public abstract boolean verifyApple(String in, String userid);

	/**
	 * 
	 * @param userName
	 * @param password
	 * @param bookid
	 * @return
	 */
	public abstract int buyBook(String userName, String password, String bookid);

	// 解析json、判断是否交易成功
	public abstract boolean jsonPars(String json);

	public abstract String ticketCheck(String ticket)
			throws KeyManagementException, NoSuchAlgorithmException,
			MalformedURLException, ProtocolException, IOException;
	
	public abstract User getUserByUserName(String userName);

}